<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>

<div id="app">
    <h1>数组的v-for</h1>
    <ul>
        <li v-for="item in items">
            {{ item.message }}
        </li>
    </ul>

    <h2>数组v-for带index</h2>
    <ul>
        <li v-for="(item, index) in items">
            {{ parentMessage }} - {{ index }} - {{ item.message}}
        </li>
    </ul>
    <h1>对象的v-for</h1>
    <ul id="v-fo-object">
        <li v-for="value in object">
            {{ value }}
        </li>

    </ul>

    <h2>对象的v-for 带key</h2>
    <ul>
        <li v-for="(value, key) in object">
            {{key}}:{{value}}
        </li>
    </ul>

    <h2>对象的v-for 带key、index</h2>
    <ul>
        <li v-for="(value,key,index) in object">
            {{ index}}.{{ key }}:{{ value }}
        </li>
    </ul>
</div>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            parentMessage:'parent ',
            items:[
                {message:'Foo'},
                {message:'Bar'}
            ],
            object:{
                firstName:'ma',
                lastName:'lin',
                age:24
            }
        }

    })

</script>

</body>
</html>